package net.huashitong.synthetical.jobOversee.Service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.synthetical.jobOversee.dao.JobMissionDao;
import net.huashitong.synthetical.jobOversee.entity.JobMission;
import net.huashitong.synthetical.jobOversee.filter.JobMissFilter;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 督查任务
 */
@Service
public class JobMissionService extends StringPKService<JobMission> {

    @Autowired
    private JobMissionDao dao;

    @Autowired
    private SysTableService sysTableService;

    @Override
    protected BaseDao<JobMission, String> getDao() {
        return dao;
    }

    //保存前调用设置主键
    @Override
    protected void beforeSave(JobMission obj) {
        obj.setSysId(sysTableService.updateMaxSysId("t_jobmission",null));

    }

    //保存任务
    public void saveJob(JobMissFilter filter)
    {
        JobMission job  = new JobMission();
        BeanUtils.copyProperties(filter,job);
        save(job);
    }



}
